package com.example.appjam;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;

public class HomeActivity extends Activity {
	ImageView tab_home, tab_bookmark, tab_map, tab_area, tab_setting;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_home);
		
		tab_home = (ImageView)findViewById(R.id.tab_home);
		tab_bookmark = (ImageView)findViewById(R.id.tab_bookmark);
		tab_map = (ImageView)findViewById(R.id.tab_map);
		tab_area = (ImageView)findViewById(R.id.tab_area);
		tab_setting = (ImageView)findViewById(R.id.tab_setting);
		
		tab_home.setOnClickListener(tab_listener);
		tab_bookmark.setOnClickListener(tab_listener);
		tab_map.setOnClickListener(tab_listener);
		tab_area.setOnClickListener(tab_listener);
		tab_setting.setOnClickListener(tab_listener);

		tab_home.setImageResource(R.drawable.home_selected);
	}

	ImageView.OnClickListener tab_listener = new ImageView.OnClickListener(){

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			switch(v.getId()){
			case R.id.tab_home:
				break;
				
			case R.id.tab_bookmark:	
				Intent intent2 = new Intent(HomeActivity.this, BookmarkActivity.class);
				startActivity(intent2);
				finish();
				break;
				
			case R.id.tab_map:
				Intent intent3 = new Intent(HomeActivity.this, MapViewActivity.class);
				startActivity(intent3);
				finish();
				break;
				
			case R.id.tab_area:
				Intent intent4 = new Intent(HomeActivity.this, AreaActivity.class);
				startActivity(intent4);
				finish();
				break;
				
			case R.id.tab_setting:
				Intent intent5 = new Intent(HomeActivity.this, SettingActivity.class);
				startActivity(intent5);
				finish();
				break;
			}
		}
		
	};
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.home, menu);
		return true;
	}

}
